//
//  RegisterTwoViewController.m
//  HTP
//
//  Created by 陈钱钿 on 15/11/1.
//  Copyright © 2015年 nit. All rights reserved.
//

#import "RegisterTwoViewController.h"
#import "RegisterThreeViewController.h"
@interface RegisterTwoViewController ()
@property (nonatomic, retain) UITextField *Field;
@end

@implementation RegisterTwoViewController

- (void)viewDidLoad {
    
    
    [super viewDidLoad];
    [self addCustomTitleWithTitle:@"验证手机号码"];
    
    UIButton *back = [UIButton buttonWithType:UIButtonTypeCustom];
    back.frame = CGRectMake(0, 20, 15, 20);
    [back setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
    [back addTarget:self action:@selector(doBack) forControlEvents:UIControlEventTouchUpInside];
    
    UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:back];
    self.navigationItem.leftBarButtonItem = backItem;
    
    self.view.backgroundColor = [UIColor whiteColor];
    [self initUI];
}

//TODO:绘制UI
- (void)initUI{
    self.Field = [[UITextField alloc] initWithFrame:CGRectMake((ScreenWidth-180)/2, ScreenHeihgt/4, 120, 30)];
    self.Field.placeholder = @"请输入验证码";
    self.Field.keyboardType = UIKeyboardTypePhonePad;
    self.Field.font = [UIFont systemFontOfSize:18];
    [self.view addSubview:self.Field];
    
    UIImageView *line = [[UIImageView alloc] initWithFrame:CGRectMake((ScreenWidth-240)/2, CGRectGetMaxY(self.Field.frame), 160, 2)];
    line.image = [UIImage imageNamed:@"black_line"];
    line.alpha = 0.5;
    [self.view addSubview:line];
    
    UIButton *rect = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(line.frame), ScreenHeihgt/4, 80, 32)];
    [rect setBackgroundImage:[UIImage imageNamed:@"get_again"] forState:UIControlStateNormal];
    [rect setTitle:@"50秒后重新获取" forState:UIControlStateNormal];
    rect.titleLabel.font = [UIFont systemFontOfSize:11.0];
    [self.view addSubview:rect];
    
    UIButton *confirmBtn = [[UIButton alloc] initWithFrame:CGRectMake((ScreenWidth-240)/2, CGRectGetMaxY(rect.frame)+40, 240, 40)];
    [confirmBtn setBackgroundImage:[UIImage imageNamed:@"confirm"] forState:UIControlStateNormal];
    [confirmBtn addTarget:self action:@selector(confirmClick) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:confirmBtn];
}

/*
 确认按钮的点击
 */
- (void)confirmClick{
    RegisterThreeViewController *threeVc = [[RegisterThreeViewController alloc] init];
    [self.navigationController pushViewController:threeVc animated:YES];
}

- (void)doBack {
    [self.navigationController popViewControllerAnimated:YES];
}


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [self.view endEditing:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
